﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;

namespace WebApplication6
{
    public partial class gouwuchelist : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["yonghu"] == null)
            {
                Response.Write("<script language=javascript>alert('请先登录');window.location.href='login.aspx';</script>");
                return;
            }
            string username = Convert.ToString(Session["yonghu"]);    

            PagedDataSource Pgds = new PagedDataSource();

            DataTable dt = SQLHelper.ExecuteDataTable("select * from t_gouwuche where username='"+username+"'");

            double zongjia = 0;
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DataRow row = dt.Rows[i];
                double zongjia2 = Convert.ToDouble(row["zongjia"]);
                zongjia = zongjia + zongjia2;

            }

            Label1.Text = Convert.ToString(zongjia);
            Pgds.DataSource = dt.DefaultView;

            gouwchelistRepeater.DataSource = Pgds;
            gouwchelistRepeater.DataBind();
        }
    }
}
